<template>
  <div>
    <swiper-item>
      <p class="name">{{integralName}}</p>
      <p class="nameIntegral">获得{{integralNum}}美豆&nbsp;{{practiceTime}}</p>
    </swiper-item>
  </div>
</template>

<script>
  export default {
    props:{
      integralName:{
        type: String,
      },
      integralNum:{
        type: Number,
      },
      integralTime:{
        type: Number,
      },
    },
    computed:{
      practiceTime(){
        return this.formatDateTime(this.integralTime)
      }
    },
    methods: {
      formatDateTime (inputTime) {
        let date = new Date(inputTime);
        let y = date.getFullYear();
        let m = date.getMonth() + 1;
        m = m < 10 ? ('0' + m) : m;
        let d = date.getDate();
        d = d < 10 ? ('0' + d) : d;
        let h = date.getHours();
        h = h < 10 ? ('0' + h) : h;
        let minute = date.getMinutes();
        let second = date.getSeconds();
        minute = minute < 10 ? ('0' + minute) : minute;
        second = second < 10 ? ('0' + second) : second;
        //return y + '-' + m + '-' + d + '　' + h + ':' + minute + ':' + second;
        return h + ':' + minute + ':' + second;
      },
    }
  }
</script>

<style scoped>
  swiper-item{
    display: flex;
    height: auto!important;
  }
</style>
